package com.cyl.game.demos.web.service.Impl;

import java.util.List;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.cyl.game.demos.web.entity.UserSkinrelation;
import com.cyl.game.demos.web.mapper.UserSkinMapper;
import com.cyl.game.demos.web.service.UserSkinService;

import lombok.RequiredArgsConstructor;

@Service
@Transactional
@RequiredArgsConstructor
public class UserSkinServiceImpl implements UserSkinService {

    private final UserSkinMapper userSkinMapper;

    @Override
    public void addUserSkin(UserSkinrelation userSkin) {
        userSkinMapper.insertUserSkin(userSkin);
    }

    @Override
    public List<UserSkinrelation> getUserSkinsByUserId(Integer user_id) {
        return userSkinMapper.selectUserSkinsByUserId(user_id);
    }

    @Override
    public boolean hasSkin(Integer user_id, Integer skin_id) {
        return userSkinMapper.hasSkinByIds(user_id, skin_id);
    }

    @Override
    public void deleteUserSkin(Integer user_id, Integer skin_id) {
        userSkinMapper.deleteUserSkinByIds(user_id, skin_id);
    }
}